﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace Api.Shared.Model.Abb
{
    public class AbbCode
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        public string TwoCode { get; set; } = string.Empty;
        public string OneCode { get; set; } = string.Empty;
        public string Description { get; set; } = string.Empty;
        public string Type2 { get; set; } = string.Empty;
        public string Type1 { get; set; } = string.Empty;

        [SugarColumn(IsNullable = true)]
        public int Type3 { get; set; }

        [SugarColumn(IsNullable = true)]
        public int Type4 { get; set; }

        public string? Remark { get; set; } = string.Empty;
        public DateTime CreateTime { get; set; } = DateTime.Now;
        public DateTime UpdateTime { get; set; } = DateTime.Now;
        public string? CreateUser { get; set; } = string.Empty;
        public string? UpdateUser { get; set; } = string.Empty;
        public string? DeleteUser { get; set; } = string.Empty;
        public bool IsDelete { get; set; } = false;

        [SugarColumn(IsNullable = true)]
        public DateTime? DeleteTime { get; set; } = null;
        public string? DeleteRemark { get; set; } = string.Empty;
        public int CodeType2
        {
            get
            {
                return Type2 switch
                {
                    "双顶出" => 1, // 双顶出

                    "左顶出" => 2, // 左顶出
                    "右顶出" => 3, // 右顶出
                    "双侧出" => 4, // 双侧出
                    "左侧出" => 5, // 左侧出
                    "右侧出" => 6, // 右侧出
                    _ => 0, // 其他类型
                };
            }
        } // 代码类型
        public int CodeType1
        {
            get
            {
                return Type1 switch
                {
                    "上隔离（六角）" => 1, // 上隔离（六角）
                    "上隔离（花键）" => 2, // 上隔离（花键）
                    "下隔离（六角）" => 3, // 下隔离（六角）
                    "下隔离（花键）" => 4, // 下隔离（花键）
                    _ => 0, // 其他类型
                };
            }
        } // 代码类型

        [SugarColumn(IsNullable = true)]
        public int? CodeType3 { get; set; } // 代码类型3

        [SugarColumn(IsNullable = true)]

        public int? CodeType4 { get; set; } // 代码类型3
    }
}

/*

                    "上隔离（六角）" => 2, // 上隔离（六角）
                    "上隔离（花键）" => 3, // 上隔离（花键）
                    "下隔离（六角）" => 4, // 下隔离（六角）
                    "下隔离（花键）" => 5, // 下隔离（花键）

 */
